<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Functions</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="Smarty 3 Manual">
<link rel="up" href="language.basic.syntax.html" title="Chapter 3. Basic Syntax">
<link rel="prev" href="language.syntax.variables.html" title="Variables">
<link rel="next" href="language.syntax.attributes.html" title="Attributes">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr><th colspan="3" align="center">Functions</th></tr>
<tr>
<td width="20%" align="left">
<a accesskey="p" href="language.syntax.variables.html">Prev</a> </td>
<th width="60%" align="center">Chapter 3. Basic Syntax</th>
<td width="20%" align="right"> <a accesskey="n" href="language.syntax.attributes.html">Next</a>
</td>
</tr>
</table>
<hr>
</div>
<div class="sect1" title="Functions">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="language.syntax.functions"></a>Functions</h2></div></div></div>
<p>
  Every Smarty tag either prints a
  <a class="link" href="language.variables.html" title="Chapter 4. Variables">variable</a> or invokes some sort
  of function. These are processed and displayed by enclosing the
  function and its
  <a class="link" href="language.syntax.attributes.html" title="Attributes">attributes</a>
  within delimiters like so:
  <code class="literal">{funcname attr1="val1" attr2="val2"}</code>.
 </p>
<div class="example">
<a name="id344013"></a><p class="title"><b>Example 3.3. function syntax </b></p>
<div class="example-contents"><pre class="programlisting">

{config_load file="colors.conf"}

{include file="header.tpl"}
{insert file="banner_ads.tpl" title="My Site"}

{if $logged_in}
    Welcome, &lt;span style="color:{#fontColor#}"&gt;{$name}!&lt;/span&gt;
{else}
    hi, {$name}
{/if}

{include file="footer.tpl"}

  </pre></div>
</div>
<br class="example-break"><div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>
  Both <a class="link" href="language.builtin.functions.html" title="Chapter 7. Built-in Functions">built-in functions</a>
  and <a class="link" href="language.custom.functions.html" title="Chapter 8. Custom Functions">custom functions</a>
  have the same syntax within templates.
  </p></li>
<li class="listitem"><p>Built-in functions are the
  <span class="bold"><strong>inner</strong></span> workings of Smarty, such as
  <a class="link" href="language.function.if.html" title="{if},{elseif},{else}"><code class="varname">{if}</code></a>,
  <a class="link" href="language.function.section.html" title="{section},{sectionelse}"><code class="varname">{section}</code></a> and
  <a class="link" href="language.function.strip.html" title="{strip}"><code class="varname">{strip}</code></a>.
  There should be no need to change or modify them.
  </p></li>
<li class="listitem"><p>Custom functions are
  <span class="bold"><strong>additional</strong></span>
  functions implemented via <a class="link" href="plugins.html" title="Chapter 18. Extending Smarty With Plugins">plugins</a>.
  They can be modified to your liking, or you can create new ones.
  <a class="link" href="language.function.html.options.html" title="{html_options}">
  <code class="varname">{html_options}</code></a>
  is an example of a custom function.
 </p></li>
</ul></div>
<p>
 See also <a class="link" href="api.register.plugin.html" title="registerPlugin()"><code class="varname">registerPlugin()</code></a>
 </p>
</div>
<div class="navfooter">
<hr>
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left">
<a accesskey="p" href="language.syntax.variables.html">Prev</a> </td>
<td width="20%" align="center"><a accesskey="u" href="language.basic.syntax.html">Up</a></td>
<td width="40%" align="right"> <a accesskey="n" href="language.syntax.attributes.html">Next</a>
</td>
</tr>
<tr>
<td width="40%" align="left" valign="top">Variables </td>
<td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td>
<td width="40%" align="right" valign="top"> Attributes</td>
</tr>
</table>
</div>
</body>
</html>
